package com.jvm.learn.oomtest;

import java.util.ArrayList;
import java.util.List;

/**
 * 堆溢出
 * java堆[所有线程共享]，存储：存放对象实例；细分：新生代、老生代
 * VM args:-Xms20M -Xmx20M -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError
 * 堆内存大小恒定20M
 * @author eg366
 *
 */
public class HeapSpaceTest {
	public static void main(String[] args) {
		List<OOMObject> list = new ArrayList<OOMObject>();
		while(true){
			OOMObject o = new OOMObject();
			list.add(o);
//			o = null;
		}
	}
}
